#include "tabooState.h"
#include "main-tools.h"
#include <stdio.h>
#include <stdlib.h>

PtabooState initTabooState(int* N, int* K, TabooExpire initTime){
	PtabooState result=(PtabooState)malloc(sizeof(TabooState));
	checkMalloc(result,"tabooLists.c:initTabooLists:1");
	result->K=K;

	int k;
	int i;
	int j;
	result->tls = malloc(*K*sizeof(PtabooList));
	checkMalloc(result->tls,"tabooLists.c:initTabooLists:2");
	for (k=0; k<*K; k++)
		result->tls[k] = initTabooList(N, initTime);
	return result;
}

void freeTabooState(PtabooState pts){
	int k;
	for (k=0; k<*pts->K; k++)
		freeTabooList(pts->tls[k]);
	free(pts);
}

PtabooList getTabooListInTabooState(PtabooState pts, int k){
	return pts->tls[k];
}

void printTabooState(FILE* f, PtabooState pts, TabooExpire now){
	fprintf(f, "\nStampa dello Stato Taboo.\n");
	int k;
	for (k=0; k<*pts->K; k++)
		printTabooListTenures(f, pts->tls[k], now, k);
}

void printTabooStateAsSet(FILE* f, PtabooState pts, TabooExpire now) {
	fprintf(f, "\nStampa dello Stato Taboo.\n");
	int k;
	for(k=0; k<*pts->K; k++)
		printTabooListAsSet(f, pts->tls[k], now, k);
}

void resetTabooState(PtabooState pts,TabooExpire resetvalue){
	int i;
	for (i=0;i<*pts->K;i++){
		//TODO oddio!! come mai non c'è il codice?!?!?!?
	}
}
